<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="layout :: common_header(~{::title})">
    <title>采购统计 - [[${T(com.b2c.erp.DataConfigObject).getInstance().getSysName()}]]</title>
</head>
<body th:replace="layout :: common_body(~{::div.layui-body})">

<div class="layui-body" style="padding:15px;top: 0px;">
    <style type="text/css">
        .record-box h2 {
            font-weight: bold;
            font-size: 18px;
            margin-bottom: 40px;
        }

        .record-input input {
            width: 400px;
            height: 22px;
            line-height: 22px;
            font-size: 16px;
            padding: 14px 9px;
            border: 1px solid #787878;
        }
    </style>
    <!-- start sp-wrapper -->
    <link rel="stylesheet" href="/sb/stock.css"/>
    <div class="sp-wrapper">
        <div class="sp-tool">
            <span class="fl">
                <form action="/stock_in/purchase_in_list_count" method="get">
                <b>日期：<input type="text" name="startDate" th:value="${startDate}" class="date" id="strat_date"> -
                <input type="text" th:value="${endDate}" name="endDate" class="date" id="end_date"></b>
                <b><input type="text"  name="goodNumber" style="width: 200px;" autocomplete="off" th:value="${goodNumber}" placeholder="输入商品编码" id="goodNumber"></b>
                <b><input type="text"  name="specNumber" style="width: 200px;" autocomplete="off" th:value="${specNumber}" placeholder="输入SKU" id="specNumber"></b>
                <b><input type="submit" class="button" value="查询"></b>
                    <b>总共：&nbsp;[[${totalSize}]]&nbsp;条记录</b>
                 <div class="layui-inline" >
                    <a class="layui-btn layui-btn-primary" href="javascript:;" id="export_order">导出excel</a>
                </div>
                </form>
            </span>
        </div>
        <div class="sp-table">
            <table>
                <thead>
                <tr>
                    <th>规格ID</th>
                    <th>规格编码</th>
                    <th>规格</th>
                    <th>商品名称</th>
                    <th>商品编码</th>
                    <th>入库数量</th>
                    <th>采购总价</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="item:${list}">
                    <td th:text="${item.getSpecId()}">CG190411100335401</td>
                    <td th:text="${item.getSpecNumber()}">CG190411100335401</td>
                    <td >
                        <span th:text="${item.getColorValue()}"></span>
                        <span th:text="${item.getSizeValue()}"></span>
                    </td>
                    <td th:text="${item.getGoodsName()}">CG190411100335401</td>
                    <td th:text="${item.getGoodsNumber()}"></td>
                    <td th:text="${item.getQuantity()}"></td>
                    <td th:text="${'￥'+#numbers.formatDecimal(item.getPurPrice(),0,'COMMA',2,'POINT')}"></td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="pages">
            <paging:pager th:value="${pageIndex}" th:rows="${totalSize}" th:size="${pageSize}"/>
        </div>
    </div>


    <script type="text/javascript" src="/sb/jquery.min.js"></script>
    <script type="text/javascript" src="/sb/Tips.min.js"></script>

    <style type="text/css">
        .check-box {
            position: relative;
            width: 900px;
            padding: 0 5px;
            font-size: 13px;
            color: #787878;
        }

        .check-info {
            line-height: 40px;
            overflow: hidden;
        }

        .check-info span {
            float: left;
            width: 18%;
            text-align: center;
        }

        .check-info span:nth-child(1) {
            width: 30%;
            text-align: left;
        }

        .check-info span:nth-child(5) {
            width: 16%;
            text-align: right;
        }

        .check-table {
            margin: 10px 0;
            max-height: 250px;
            overflow-y: auto;
        }

        .check-table table {
            width: 100%;
        }

        .check-table th, .check-table td {
            padding: 10px 0;
            font-size: 13px;
            text-align: center;
            border: 1px solid #787878;
        }

        .check-table th {
            padding: 5px 0;
        }
    </style>
    <script type="text/javascript">
        layui.use(['laydate', 'layer'], function () {
            var laydate = layui.laydate;
            var layer = layui.layer;
            //执行一个laydate实例
            $(".print").click(function () {
                var id = $(this).attr("data-id");
                console.log(id);
                //iframe层
                layer.open({
                    type: 2,
                    title: '打印入库单',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['940px', '90%'],
                    content: '/stock_in/stock_in_print_detail?id=' + id //iframe的url
                });
            });
        });
        layui.use(['laydate', 'layer'], function () {
            var laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
                elem: '#strat_date' //指定元素
            });
        });
        layui.use(['laydate', 'layer'], function () {
            var laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
                elem: '#end_date' //指定元素
            });
        });
        $("#export_order").click(function () {
            var startDate = $("#strat_date").val();
            var endDate = $("#end_date").val();
            var goodNumber = $("#goodNumber").val();
            var specNumber = $("#specNumber").val();
            window.location.href = "/stock_in/purchase_in_list_count_export?startDate=" + startDate + "&endDate=" + endDate+ "&goodNumber=" + goodNumber+ "&specNumber=" + specNumber;
        })
    </script>
</div>
</div>
</body>
</html>
